<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>用户管理</title>

    <link href="../plugin/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../plugin/sweetalert-6.6.2/sweetalert2.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
    <link href="../plugin/jquery-zoomify/zoomify.min.css" rel="stylesheet"/>

    <script src="../plugin/jquery-3.2.1/jquery-3.2.1.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/local_zh.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="../plugin/lysj/bootstrap-table.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../plugin/sweetalert-6.6.2/sweetalert2.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.formautofill.min.js"></script>
    <script src="../plugin/jquery-zoomify/zoomify.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.serializejson.js"></script>
    <script src="../plugin/lysj/utils3_pageable.js"></script>
    <script src='../base/base.js'></script>
</head>
<body>
<!--比特币钱包详情模态框-->
<div class="modal fade" data-backdrop="static" id="user_manager_modal_edit_detail_bitcoin">
    <div class="modal-dialog modal-lg " style="width: 1080px">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">
                    <b>比特币钱包详情</b>
                </h4>
            </div>
            <div class="panel panel-default">
                <div class="panel-body">
                    <table class="table table-bordered">
                        <tr>
                            <td><strong>比特币钱包真实余额(单位：比特):</strong></td>
                            <td id="user_manager_detail_bitcoin_book_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>比特币钱包可用余额(单位：比特):</strong></td>
                            <td id="user_manager_detail_bitcoin_avail_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>比特币钱包总额(单位：比特):</strong></td>
                            <td id="user_manager_detail_bitcoin_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>比特币钱包冻结余额(单位：比特):</strong></td>
                            <td id="user_manager_detail_bitcoin_freeze_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>比特币钱包guid:</strong></td>
                            <td id="user_manager_detail_bitcoin_guid"></td>

                        </tr>
                        <tr>
                            <td><strong>比特币钱包HD地址:</strong></td>
                            <td id="user_manager_detail_bitcoin_hdAddress"></td>
                        </tr>
                        <tr>
                            <td><strong>比特币钱包最新的子地址:</strong></td>
                            <td id="user_manager_detail_bitcoin_lastAddress"></td>
                        </tr>
                        <tr>
                            <td><strong>比特币钱包邮箱:</strong></td>
                            <td id="user_manager_detail_bitcoin_email"></td>
                        </tr>
                        <tr>
                            <td><strong>比特币钱包标签:</strong></td>
                            <td id="user_manager_detail_bitcoin_label"></td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--以太坊钱包详情模态框-->
<div class="modal fade" data-backdrop="static" id="user_manager_modal_edit_detail_ethereum">
    <div class="modal-dialog modal-lg " style="width: 1080px">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">
                    <b>以太坊钱包详情</b>
                </h4>
            </div>
            <div class="panel panel-default">
                <div class="panel-body">
                    <table class="table table-bordered">
                        <tr>
                            <td><strong>以太坊钱包真实余额(单位:以太):</strong></td>
                            <td id="user_manager_detail_ethereum_book_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>以太坊钱包可用余额(单位:以太):</strong></td>
                            <td id="user_manager_detail_ethereum_avail_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>以太坊钱包总额(单位:以太):</strong></td>
                            <td id="user_manager_detail_ethereum_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>以太坊钱包冻结余额(单位:以太):</strong></td>
                            <td id="user_manager_detail_ethereum_freeze_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>以太坊钱包地址:</strong></td>
                            <td id="user_manager_detail_ethereum_address"></td>
                        </tr>
                        <tr>
                            <td><strong>以太坊秘钥文件名:</strong></td>
                            <td id="user_manager_detail_ethereum_keystore"></td>
                        </tr>
                        <tr>
                            <td><strong>以太坊秘钥密码:</strong></td>
                            <td id="user_manager_detail_ethereum_keyword"></td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--BHPC钱包详情模态框-->
<div class="modal fade" data-backdrop="static" id="user_manager_modal_edit_detail_bhpc">
    <div class="modal-dialog modal-lg " style="width: 1080px">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">
                    <b>BHPC钱包详情</b>
                </h4>
            </div>
            <div class="panel panel-default">
                <div class="panel-body">
                    <table class="table table-bordered">
                        <tr>
                            <td><strong>BHPC钱包真实余额(单位:BHPC):</strong></td>
                            <td id="user_manager_detail_bhpc_book_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC钱包可用余额(单位:BHPC):</strong></td>
                            <td id="user_manager_detail_bhpc_avail_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC钱包总额(单位:BHPC):</strong></td>
                            <td id="user_manager_detail_bhpc_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC钱包冻结余额(单位:BHPC):</strong></td>
                            <td id="user_manager_detail_bhpc_freeze_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC钱包地址:</strong></td>
                            <td id="user_manager_detail_bhpc_address"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC可用奖励金(单位:BHPC):</strong></td>
                            <td id="user_manager_detail_reward_avail_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC奖励金总额(单位:BHPC):</strong></td>
                            <td id="user_manager_detail_reward_balance"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC冻结奖励金(单位:BHPC):</strong></td>
                            <td id="user_manager_detail_reward_freeze_balance"></td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-success pull-right" onclick="user_manager.update_bhpc_info()">修改</button>
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>

<!--BHPC钱包金额模态框-->
<div class="modal fade" data-backdrop="static" id="user_manager_modal_edit_balance_bhpc">
    <div class="modal-dialog modal-lg " style="width: 1080px">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">
                    <b>BHPC信息修改</b>
                </h4>
            </div>
            <div class="panel panel-default">
                <div class="panel-body">
                    <table class="table table-bordered">
                        <tr>
                            <td><strong>BHPC钱包真实余额(单位:BHPC):</strong></td>
                            <td><input id="user_manager_uddate_bhpc_book_balance" style="width: 100%"></td>

                        </tr>
                        <tr>
                            <td><strong>BHPC钱包可用余额(单位:BHPC):</strong></td>
                            <td><input id="user_manager_update_bhpc_avail_balance" style="width: 100%"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC钱包总额(单位:BHPC):</strong></td>
                            <td><input id="user_manager_update_bhpc_balance" style="width: 100%"></td>

                        </tr>
                        <tr>
                            <td><strong>BHPC钱包冻结余额(单位:BHPC):</strong></td>
                            <td><input id="user_manager_update_bhpc_freeze_balance" style="width: 100%"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC可用奖励金:</strong></td>
                            <td><input id="user_manager_update_reward_avail_balance" style="width: 100%"></td>

                        </tr>
                        <tr>
                            <td><strong>BHPC奖励金总额:</strong></td>
                            <td><input id="user_manager_update_reward_balance" style="width: 100%"></td>
                        </tr>
                        <tr>
                            <td><strong>BHPC冻结奖励金:</strong></td>
                            <td><input id="user_manager_update_reward_freeze_balance" style="width: 100%"></td>

                        </tr>
                    </table>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" onclick="user_manager.bhpc_balance_sure()">确认</button>
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>



<!--手动打币模态框-->
<div class="modal fade" data-backdrop="static" id="user_manager_modal_edit_play_money">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">
                    <b>手动打币</b>
                </h4>
            </div>
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="form-group"><label class="col-sm-2 control-label">会员邮箱:</label>
                        <div class="col-sm-9">
                            <input type="text" id="user_manager_play_money_email" name="user_manager_play_money_email"
                                   class="form-control" placeholder="请输入文本">
                            &nbsp;&nbsp;
                        </div>
                    </div>
                    <div class="form-group"><label class="col-sm-2 control-label">操作方式</label>
                        <div class="col-sm-9">
                            <select class="form-control" id="user_manager_play_money_operation"
                                    name="user_manager_play_money_operation"
                                    class="form-control">
                                <option value="1">增加</option>
                                <option value="2">减少</option>
                            </select>
                            &nbsp;&nbsp;
                        </div>
                    </div>
                    <div class="form-group"><label class="col-sm-2 control-label">操作币种钱包</label>
                        <div class="col-sm-9">
                            <select class="form-control" id="user_manager_play_money_wallet"
                                    name="user_manager_play_money_wallet"
                                    class="form-control">
                                <option value="100">BHPC</option>
                                <option value="110">BHPC_Bouns</option>
                                <option value="20">ETH</option>
                                <option value="10">BTC</option>
                            </select>
                            &nbsp;&nbsp;
                        </div>
                    </div>
                    <div class="form-group"><label class="col-sm-2 control-label">币量:</label>
                        <div class="col-sm-9">
                            <input type="text" id="user_manager_play_money_amount" name="user_manager_play_money_amount"
                                   class="form-control" placeholder="请输入文本">
                            &nbsp;&nbsp;
                        </div>
                    </div>
                    <div class="form-group"><label class="col-sm-2 control-label">备注:</label>
                        <div class="col-sm-9">
                            <input type="text" id="user_manager_play_money_remark" name="user_manager_play_money_remark"
                                   class="form-control" placeholder="请输入文本">
                            &nbsp;&nbsp;
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary" id="comfirm" onclick="comfirm()">确认</button>
                    <button class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!--修改锁期模态框-->
<div class="modal fade" data-backdrop="static" id="user_manager_modal_edit_lock_date">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">
                    <b>用户信息</b>
                </h4>
            </div>
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="form-group"><label class="col-sm-2 control-label">锁期时间:</label>
                        <div class="col-sm-9">
                            <input type="text" id="lock_date" name="lock_date" class="form-control" placeholder="请输入文本">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary" onclick="sure_lock()">确认</button>
                    <button class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        var resp = AjaxUtil.isLogin();
        if (!resp) return;
        var current_user_id;
        var module = 'user_manager';
        var query = [];
        // 工具条配置
        var toolbar = {
            default: [false, false, true, false],// back;add;edit;remove
            dialog: [50, 2, 9],//对话框参数:模态框宽度(百分比);表单标题宽度;表单输入框宽度
            extra: [{
                name: '比特币钱包',
                glyphicon: 'list',
                onclick: 'showBitcoinWalletDetail',
            }, {
                name: '以太坊钱包',
                glyphicon: 'list',
                onclick: 'showEthereumWalletDetail',
            }, {
                name: 'BHPC钱包',
                glyphicon: 'list',
                onclick: 'showBhpcWalletDetail',
            }, {
                name: '重置密码',
                glyphicon: 'refresh',
                onclick: 'resetPassword',
            }, {
                name: '激活用户',
                glyphicon: 'refresh',
                onclick: 'active',
            }, {
                name: '手动打币',
                glyphicon: 'list',
                onclick: 'playMoney',
            }, {
                name: '修改锁期',
                glyphicon: 'wrench',
                onclick: 'phaseLock',
            }]
        };
        var bootstrapTable = {
            columns: [{
                radio: true
            }, {
                field: 'userId',
                title: '用户编号',
            }, {
                field: 'email',
                title: '邮箱',
            }, {
                field: 'areaCode',
                title: '区号',
            }, {
                field: 'phone',
                title: '手机号',
            }, {
                field: 'dividend',
                title: '分红(ETH)',
            }, {
                field: 'status',
                title: '状态',
                formatter: function (verify, row, index) {
                    if (verify == 1) {
                        return '激活';
                    } else if (verify == 0) {
                        return '未激活';
                    }
                }
            }, {
                field: 'lockDate',
                title: '锁期倒计时',
                formatter: function (value, row, index) {
                    return formatLockTime(value);
                }
            }]
        };
        var formElement = [{
            action: [false, true],
            type: 'hidden', // 表单类型
            name: 'userId', // 字段名称
        }, {
            action: [false, true],
            type: 'text',
            label: '邮箱',
            name: 'email',
        }, {
            action: [false, true],
            type: 'text',
            label: '手机号',
            name: 'phone',
        }];
        user_manager = SingleTablePageCreateUtil.createInstance(module, query, toolbar, formElement, bootstrapTable);
        // 定义一个全局变量为当前登陆的用户
        var current_userId;

        // 显示比特币钱包详情的方法
        user_manager.showBitcoinWalletDetail = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#user_manager_table');
            if (!row) return false;

            var resp = AjaxUtil.getJson('user_manager/bitcoin_wallet_detail', 'userId=' + row.userId);
            if (!resp) return false;

            var bitcoinWallet = resp.obj;

            $('#user_manager_detail_bitcoin_book_balance').html(bitcoinWallet.bookKeepBalance);
            $('#user_manager_detail_bitcoin_avail_balance').html(bitcoinWallet.availBalance);
            $('#user_manager_detail_bitcoin_balance').html(bitcoinWallet.balance);
            $('#user_manager_detail_bitcoin_freeze_balance').html(bitcoinWallet.freezeBalance);

            $('#user_manager_detail_bitcoin_guid').html(bitcoinWallet.guid);
            $('#user_manager_detail_bitcoin_hdAddress').html(bitcoinWallet.hdAddress);
            $('#user_manager_detail_bitcoin_lastAddress').html(bitcoinWallet.lastAddress);
            $('#user_manager_detail_bitcoin_email').html(bitcoinWallet.email);
            $('#user_manager_detail_bitcoin_label').html(bitcoinWallet.label);
            $('#user_manager_modal_edit_detail_bitcoin').modal('show');

        };
        // 显示以太坊钱包详情的方法
        user_manager.showEthereumWalletDetail = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#user_manager_table');
            if (!row) return false;

            var resp = AjaxUtil.getJson('user_manager/etherum_wallet_detail', 'userId=' + row.userId);
            if (!resp) return false;

            var etherumWallet = resp.obj;
            $('#user_manager_detail_ethereum_book_balance').html(etherumWallet.bookKeepBalance);
            $('#user_manager_detail_ethereum_avail_balance').html(etherumWallet.availBalance);
            $('#user_manager_detail_ethereum_balance').html(etherumWallet.balance);
            $('#user_manager_detail_ethereum_freeze_balance').html(etherumWallet.freezeBalance);

            $('#user_manager_detail_ethereum_address').html(etherumWallet.address);
            $('#user_manager_detail_ethereum_keystore').html(etherumWallet.keystore);
            $('#user_manager_detail_ethereum_keyword').html(etherumWallet.password);
            $('#user_manager_modal_edit_detail_ethereum').modal('show');

        };


        // 显示BHPC钱包详情的方法
        user_manager.showBhpcWalletDetail = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#user_manager_table');
            if (!row) return false;
            current_user_id = row.userId;
            var resp = AjaxUtil.getJson('user_manager/bhpc_wallet_detail', 'userId=' + row.userId);

            if (!resp) return false;

            var bhpcWallet = resp.obj;


            //钱包详情模态框填充
            $('#user_manager_detail_bhpc_book_balance').html(bhpcWallet.bhpcBookKeepBalance);
            $('#user_manager_detail_bhpc_avail_balance').html(bhpcWallet.bhpcAvailBalance);
            $('#user_manager_detail_bhpc_balance').html(bhpcWallet.bhpcBalance);
            $('#user_manager_detail_bhpc_freeze_balance').html(bhpcWallet.bhpcFreezeBalance);
            $('#user_manager_detail_bhpc_address').html(bhpcWallet.address);
            $('#user_manager_detail_reward_balance').html(bhpcWallet.rewardBalance);
            $('#user_manager_detail_reward_avail_balance').html(bhpcWallet.rewardAvailBalance);
            $('#user_manager_detail_reward_freeze_balance').html(bhpcWallet.rewardFreezeBalance);

            //点击修改模态框数值填充
            $('#user_manager_uddate_bhpc_book_balance').val(bhpcWallet.bhpcBookKeepBalance);
            $('#user_manager_update_bhpc_avail_balance').val(bhpcWallet.bhpcAvailBalance);
            $('#user_manager_update_bhpc_balance').val(bhpcWallet.bhpcBalance);
            $('#user_manager_update_bhpc_freeze_balance').val(bhpcWallet.bhpcFreezeBalance);
            $('#user_manager_update_reward_balance').val(bhpcWallet.rewardBalance);
            $('#user_manager_update_reward_avail_balance').val(bhpcWallet.rewardAvailBalance);
            $('#user_manager_update_reward_freeze_balance').val(bhpcWallet.rewardFreezeBalance);

            $('#user_manager_modal_edit_detail_bhpc').modal('show');

        };


        //BHPC钱包详情点击修改模态框显示
        user_manager.update_bhpc_info = function () {
            $('#user_manager_modal_edit_detail_bhpc').modal('hide');
            $('#user_manager_modal_edit_balance_bhpc').modal('show');
        };


        // 确认修改bhpc信息
        user_manager.bhpc_balance_sure = function () {
            var resp = AjaxUtil.postJson('user_manager/update_bhpc_info', {
                userId: current_user_id,
                afterBhpcBookKeepBalance: $('#user_manager_uddate_bhpc_book_balance').val(),
                afterBhpcAvailBalance: $('#user_manager_update_bhpc_avail_balance').val(),
                afterBhpcBalance: $('#user_manager_update_bhpc_balance').val(),
                afterBhpcFreezeBalance: $('#user_manager_update_bhpc_freeze_balance').val(),

                afterRewardAvailBalance: $('#user_manager_update_reward_avail_balance').val(),
                afterRewardBalance: $('#user_manager_update_reward_balance').val(),
                afterRewardFreezeBalance: $('#user_manager_update_reward_freeze_balance').val(),
            });

            if (resp) {
                SwalUtil.success(resp.msg);
                $('#user_manager_modal_edit_balance_bhpc').modal('hide');
            }

        };


        // 重置密码
        user_manager.resetPassword = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#user_manager_table');
            if (!row) return false;
            SwalUtil.confirm(function () {
                var resp = AjaxUtil.postJson('user_manager/reset_password', {
                    userId: row.userId,
                });
                if (resp) {
                    SwalUtil.success(resp.msg);
                    // $('#user_manager_table').bootstrapTable('refresh');
                }
            });
        };

        // 激活用户
        user_manager.active = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#user_manager_table');
            if (!row) return false;
            SwalUtil.confirm(function () {
                var resp = AjaxUtil.postJson('user_manager/active', {
                    userId: row.userId,
                });
                if (resp) {
                    SwalUtil.success(resp.msg);
                    $('#user_manager_table').bootstrapTable('refresh');
                }
            });
        };

        //手动打币的模态框
        user_manager.playMoney = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#user_manager_table');
            if (!row) return false;
            current_user_id = row.userId;
            $('#user_manager_play_money_email').val(row.email);
            $('#user_manager_play_money_amount').val('');
            $('#user_manager_play_money_remark').val('');
            $("#comfirm").removeAttr("disabled");
            $('#user_manager_modal_edit_play_money').modal('show');

        };

        //打币确认
        comfirm = function () {
            var email = $('#user_manager_play_money_email').val();
            var operation = $('#user_manager_play_money_operation').val();
            var walletType = $('#user_manager_play_money_wallet').val();
            var amount = $('#user_manager_play_money_amount').val();
            var reamrk = $('#user_manager_play_money_remark').val();
            //若用户没有修改设备数量,则不发送请求到后端
            if (amount <= 0) {
                SwalUtil.error("打币数量必须大于0")
                return;
            }
            var resp = AjaxUtil.postJson('user_manager/transfers_money', {
                userId: current_user_id,
                email: email,
                operation: operation,
                walletType: walletType,
                amount: amount,
                reamrk: reamrk
            });
            $("#comfirm").attr({"disabled": "disabled"});
            if (resp) {
                SwalUtil.success(resp.msg);
                $('#user_manager_modal_edit_play_money').modal('hide');
                $('#user_manager_table').bootstrapTable('refresh');
                $("#comfirm").removeAttr("disabled");
            }
        }
        $('#lock_date').datetimepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            minView: 2,
            autoclose: true,
        });

        // 修改锁期模态框显示
        user_manager.phaseLock = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#user_manager_table');
            if (!row) return false;
            current_user_id = row.userId;

            var d = new Date(row.lockDate);
            var year = d.getFullYear();
            var month = d.getMonth() + 1;
            if (month < 10) {
                month = '0' + month;
            }
            var date = d.getDate();
            if (date < 10) {
                date = '0' + date;
            }
            $('#lock_date').val(year + "-" + month + "-" + date)
            $('#user_manager_modal_edit_lock_date').modal('show');
        };

        sure_lock = function () {
            var resp = AjaxUtil.postJson('user_manager/lock_date', {
                userId: current_user_id,
                lockDate: $('#lock_date').val(),
            });
            if (resp) {
                SwalUtil.success(resp.msg);
                $('#user_manager_modal_edit_lock_date').modal('hide');
                $('#user_manager_table').bootstrapTable('refresh');
            }
        }

    });


    formatLockTime = function (ms) {
        //获取当前系统时间
        var timestamp = new Date().getTime()

        if (isNaN(ms)) { //不是一个数字(时间戳),返回原值
            return "无";
        }
        if (null == ms) {
            return "无";
        }

        var diff = ms - timestamp; //用户锁期时间与当前时间的差值
        var oneDay = 24 * 60 * 60 * 1000; //一天的时间搓

        //如果当前时间大于锁期时间返回无
        if (diff < 0) {
            return "无"
        }
        var remainder = diff % oneDay;

        if (remainder == 0) {
            return parseInt(diff / oneDay) + "天"
        } else {
            return (parseInt(diff / oneDay) + 1) + "天"
        }
    }
</script>
</body>

</html>